package com.corpdata.system.log.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.corpdata.common.api.pagehelper.PageConvertUtil;
import com.corpdata.common.domain.DataGridRequestDTO;
import com.corpdata.system.log.dao.OptLoggerMapper;
import com.corpdata.system.log.entity.OptLogger;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

@Service
public class OptLogService {

	@Autowired
	private OptLoggerMapper optLoggerMapper;
	
	public int addOptLogger(OptLogger record) {
		return optLoggerMapper.insert(record);
	}

	public String findOptLog(DataGridRequestDTO dgRequest) {
		PageHelper.startPage(dgRequest.getPage(), dgRequest.getLimit());
		return PageConvertUtil.getGridJson((Page<OptLogger>)optLoggerMapper.selectAll(dgRequest.getParams()));
	}
}
